<template>
	<view class="content">
		<scroll-view class="scroll_view_content" scroll-y="true" :lower-threshold="100" @scrolltolower="reachBottom">
			<view style="margin-top:10upx; margin-bottom: 80upx;">
				<ker-feng-flow :dataLists="lists"></ker-feng-flow>
			</view>
			<view style="color: #C0C0C0; font-size: 22upx; text-align: center;margin-bottom: 10upx;">
				<text v-if="!is_end">loading...</text>
				<text v-if="is_end">没了</text>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import kerfengflow from '../../components/ker-feng-flow/ker-feng-flow.vue';
	export default {
		components:{kerfengflow},
		data() {
			return {
				lists: [],
				page:1,
				is_end:false
			}
		},
		onLoad() {
			this.page = 1
			uni.request({
				url:'https://oa.tongwenkeji.com/index/index/getFlow?p='+this.page
			}).then(res=>{
				this.lists = res[1].data
				console.log(this.lists)
			})
		},
		methods: {
			reachBottom() {
				if(this.is_end) return;
				this.is_end = false
				this.page++
				uni.request({
					url:'https://oa.tongwenkeji.com/index/index/getFlow?p='+this.page
				}).then(res=>{
					if(res[1].data.length > 0){
						this.lists = res[1].data
					}else{
						this.is_end = true
					}
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.scroll_view_content{
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}
</style>
